<script setup lang="ts">
import { ref } from 'vue'
import HeaderInfo from './c-cpns/header-info.vue'
import headerBreadcrumb from './c-cpns/header-breadcrumb.vue'

const emit = defineEmits(['foldChange'])
const isFold = ref(false)
const changeAsideFoldClick = () => {
  // 内部改变状态
  isFold.value = !isFold.value
  // 将状态和事件都传递给父组件
  emit('foldChange', isFold.value)
  // console.log('main-header', isFold.value)
}
</script>
<template>
  <div class="main-header">
    <div class="header-left">
      <div class="left-icon" @click="changeAsideFoldClick">
        <el-icon size="20px">
          <component :is="isFold ? 'Expand' : 'Fold'"></component>
        </el-icon>
      </div>
      <div class="left-bread">
        <headerBreadcrumb></headerBreadcrumb>
      </div>
    </div>
    <div class="header-right">
      <HeaderInfo></HeaderInfo>
    </div>
  </div>
</template>

<style scoped lang="less">
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #ffffff;
  .header-left {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .left-icon {
      cursor: pointer;
      margin-right: 5px;
    }
    .left-bread {
    }
  }
  .header-right {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}
</style>
